<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    //
    protected $table = 'order';
    public $timestamps = false;
    /**
     * 获取订单总数
     * @return mixed
     */
    public static function getAllCount()
    {
        $res = self::count();
        return $res;
    }

    /**
     * 获取今日新增订单
     * strtotime(date("Y-m-d"))
     */
    public static function getTodayCount()
    {
        #获取北京时间零点的时间戳
        $t = date('Y-m-d H:i:s',strtotime(date("Y-m-d")));
        $res = self::where('create_time','>',$t)->count();
        return $res;
    }

    public static function getOrderInfo($id) {
        $res = self::where('id',$id)->first();
        return $res;
    }
}
